/*
                             A goat in a kitchen garden
Time Limit: 2.0 second
Memory Limit: 1 000 KB


Someone has let a goat in a square kitchen-garden and had bound it to a stake.
The stake is driven into the ground in the very midst of the square. The goat
is hungry as a hunter and very voracious, and eats everything that can be 
reached without leaving the square and tearing the roap. What area of the 
kitchen-garden will be ate round?
Input

contains lengths of the garden sides and a cord length in meters (natural 
numbers not exceeding 100, located in one line and separated with a space).
Output

should contain an area of the kitchen-garden (in square meters to within 3 
symbols after a decimal point), ate round by the goat.
Sample Input

10 6
Sample Output

95.091
*/


#include <stdio.h>
#include <math.h>

#if DEBUG
  #define DEBUG_DATASOURCE "/vol1/1084_kitchen_garden.txt"
  #include <debug/header.h>
#endif

#define PI 3.14159265358979323846

int
main (void)
{
#ifdef DEBUG
	#include <debug/init.h>
#endif
	// Radius of the rope and lengths of the kitchen sides. 
	double R, side;
	// Total area which will be eaten by the goat.
	double area;
	//  The kitchen-garden area.
	double kg_area;
	double tri_A, tri_area, seg_area;
	double alpha, beta;

	fscanf(stdin, "%lf %lf", &side, &R);
	kg_area = side * side;
	if (R <= (side / 2)) {
		area = PI * R * R;
	}
	else if (R < sqrt (side * side / 2)) {
		// Calculation of the area of the kitchen-garden corners which
		// cannot be reached by the goat.
		alpha = acos((side / 2) / R);
		beta = (PI / 2) - 2 * alpha;
		
		// The area of the circular segment.
		seg_area = R * R * (beta - sin(beta)) / 2;
		
		tri_A = (side / 2) - sin(alpha) * R;
		tri_area = tri_A * tri_A / 2;
		area = kg_area - 4 * (tri_area - seg_area);
	}
	else {
		// All will be eaten by the goat.
		area = side * side;
	}
	fprintf (stdout, "%.3f\n", area);
	return 1;
}

